package com.jsy.mini12306.manage.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.jsy.mini12306.common.entity.TrainPassStation;
import com.jsy.mini12306.common.util.StringToLocalDateTimeUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * @author: SongyangJi
 * @description:
 * @since: 2021/9/3
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TrainPassStationExcel {

    /**
     * 列车经停的顺序
     */
    @ExcelProperty(index = 0)
    private Integer sequence;
    /**
     * 站次
     */
    @ExcelProperty(index = 1)
    private String stationName;
    /**
     * 到达时间
     */
    @ExcelProperty(index = 2)
    private String arrivalTime;

    /**
     * 发车时间
     */
    @ExcelProperty(index = 3)
    private String departTime;


    public TrainPassStation wrap() {

        return TrainPassStation.builder()
                .sequence(sequence)
                .arrivalTime(StringToLocalDateTimeUtil.convertStringToLocalTime(arrivalTime))
                .departTime(StringToLocalDateTimeUtil.convertStringToLocalTime(departTime)).build();
    }


}
